<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">

<section class="content-header">
    <h1>
        甲供件-原料库入库单
    </h1>
</section>
<section class="content">
    <form id="inBillForm" role="form"
          enctype="multipart/form-data">
        <input type="hidden" id="odrId" th:value="${order.odrId}">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-body">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group">
                                    <label>单据编号</label>
                                    <input type="text" class="form-control" name="" th:value="${order.odrCode}"
                                           placeholder=""
                                           readonly="readonly"/>
                                </div>
                                <div class="form-group">
                                    <labe>入库类型</labe>
                                    <select id="odrType" name="odrType" class="form-control" disabled="disabled">
                                        <option value="" th:selected="${order.odrType == null}">请选择</option>
                                        <option value="1" th:selected="${order.odrType == 1}">采购入库</option>
                                        <option value="2" th:selected="${order.odrType == 2}">退料入库</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>库位</label>
                                    <select id="odrWhiId" class="form-control" name="odrWhiId" disabled="disabled">
                                        <option value="">请选择</option>
                                        <option th:each="type:${warehouse}" th:value="${type.whiId}"
                                                th:text="${type.whiName}"
                                                th:selected="${order.odrWhiId == type.whiId}"></option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>经手人</label>
                                    <input id="odrTakePerson" type="text" class="form-control" name=""
                                           placeholder="" th:value="${order.odrTakePerson}"
                                           autocomplete="off" readonly="readonly"/>
                                </div>
                                <div class="form-group">
                                    <label>摘要</label>
                                    <input id="odrRemark" type="text" class="form-control" name="" placeholder=""
                                           th:value="${order.odrRemark}"
                                           autocomplete="off" readonly="readonly"/>
                                </div>
                                <div class="form-group">
                                    <label>签收单回货日期</label>
                                    <input type="text" class="form-control datepicker"
                                           th:value="${#dates.format(order.odrDate, 'yyyy-MM-dd')}"
                                           id="odrDate" name="odrDate" readonly="readonly"/>
                                </div>
                            </div>
                            <div class="row">
                                <div id="hot"></div>
                            </div>
                        </div>
                        <div class="box-footer">
                            <div class="row">
                                <div class="col-md-2">
                                    <label>制单人：</label><label th:text="${order.odrMakePerson}"></label>
                                </div>
                                <div class="col-md-2">
                                    <label>制单时间：</label><label
                                        th:text="${#dates.format(order.odrMakeDate, 'yyyy-MM-dd hh:mm:ss')}"></label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
    </form>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">

    $(function () {

        // 金额权限判断
        var arr;
        if (hasP("matwar:amount:view")) {
            arr = [0];
        } else {
            arr = [0, 9];
        }
        js.get({
            url: ctx + "materialInto/orderDetail",
            data: {odrId: $('#odrId').val()},
            success: function (result) {
                var resu = result.data;
                /**表单加载*/
                js.hot.init({
                    element: document.getElementById('hot'),
                    data: result.data,
                    formData: ["odrType", "odrTakePerson", "odrRemark", "odrDate", "odrWhiId"],
                    colHeaders: ['ID', '类型', '材质', '规格', '宽度', '长度', '米重/厚度', '数量', '重量',  '跟踪号', '项目编号', '项目名称','供应商','合同编号', '区位','在库类型', '回货时间', '回货重量', '特殊说明', 'SAP物料编码'],
                    fieldName: ['odaId', 'matType', 'matQuality', 'matSpec', 'matWidth', 'matLength', 'matHeight', 'odaNum', 'odaWeight',  'odaTrackCode', 'odaProCode', 'odaProName','supplier', 'contractNo', 'odaPosition', 'odaInTypeName', 'odaBackDate', 'odaBackWeight', 'odaSpec', 'odaMatSapCode'],
                    height: 700,
                    correctFormat: true,
                    minSpareRows: 100,
                    hiddenColumns: {
                        columns: arr,
                        indicators: true
                    },
                    columns: [
                        {
                            data: 'odaId',
                            type: 'numeric',
                            width: 40
                        },
                        {
                            data: 'matType',
                            type: 'text',
                            editor: false
                        },
                        {
                            data: 'matQuality',
                            type: 'text',
                            editor: false
                        },
                        {
                            data: 'matSpec',
                            type: 'text',
                            editor: false
                        },
                        {
                            data: 'matWidth',
                            type: 'numeric',
                            editor: false
                        },
                        {
                            data: 'matLength',
                            type: 'numeric',
                            editor: false
                        },
                        {
                            data: 'matHeight',
                            type: 'numeric',
                            editor: false
                        },
                        {
                            data: 'odaNum',
                            type: 'numeric',
                            editor: false
                        },
                        {
                            data: 'odaWeight',
                            type: 'numeric',
                            editor: false
                        },
                        {
                            data: 'odaTrackCode',
                            type: 'text',
                            editor: false
                        },
                        {
                            data: 'odaProCode',
                            type: 'text',
                            editor: false
                        },
                        {
                            data: 'odaProName',
                            type: 'text',
                            editor: false
                        },
                        {
                            data: 'supplier',//供应商supplier
                            type: 'text'
                        },
                        {
                            data: 'contractNo',//合同编号contractNo
                            type: 'text'
                        },
                        {
                            data: 'odaPosition',
                            type: 'text'
                        },
                        {
                            data: 'odaInTypeName',
                            type: 'dropdown',
                            source: ['库存在库', '项目在库'],
                            editor: false
                        },
                        {
                            data: 'odaBackDate',
                            type: 'text',
                            editor: false
                        },
                        {
                            data: 'odaBackWeight',
                            type: 'text',
                            editor: false
                        },
                        {
                            data: 'odaSpec',
                            type: 'text',
                            editor: false
                        },
                        {
                            data: 'odaMatSapCode',
                            type: 'text',
                            editor: false
                        }
                    ]
                })
            }
        });
    })

</script>


</body>
</html>